|
|
|
|
|
|
|
the information from the copy buffer to the recordset. In the case of AddNew, Update also creates a blank record in the recordset to which the information is written. In a multiuser environment, the Update method also clears the record locks associated with the pending Add or Edit method. |
|
|
|
|
|
|
|
|
|
If you use Data controls to work with recordsets, the use of the Update method is not required. An update is automatically performed when a move is executed by the Data control.  |
|
|
|
|
|
|
|
|
|
|
Deleting a record requires the use of the Delete method. After you locate the appropriate record (and make it current), invoking the recordset's Delete method permanently removes the record from the table. This method removes the record from the recordset and sets the record pointer to a null value. The Delete method is illustrated in this line of code: |
|
|
|
|
CAUTION
|
|
|
|
|
After you delete a record, it is gone without warning. You can recover the record only if you issued a BeginTrans command before you deleted the record, in which case you can use RollBack to recover the transaction. Otherwise, the only way to get the information back into the database is to re-create the record by using the AddNew method. |
|
|
|
|
|
|
|
|
|
|
|
Deletions and changes to the database are made without confirmation by the users. If you want your program to have confirmation built in, you have to provide it in your code. The easiest way to do so is through the MsgBox function. With this function, you can provide a warning to the users and ask for confirmation.  |
|
|
|
|
|
|
|
|
|
|
Introducing Transaction Processing |
|
|
|
|
|
|
|
|
Transaction processing enables you to treat a group of changes, additions, or deletions to a database as a single entity. This capability is useful when one change to a database depends on another change, and you want to make sure that all changes are made before any of the changes become permanent. For example, you have a point-of-sale application that updates inventory levels as sales are made. As each item is entered for the sales transaction, a change is made to the inventory database. However, you want to keep only the inventory changes if the sale is completed. If the sale is aborted, you want to return the inventory database to its initial state before the sale was started. Transaction processing is a function of the Workspace object and, therefore, affects all databases open in a particular workspace. |
|
|
|
|
|